<?php
require (SERVER_ROOT_PATH . '/lib/funcs.php');

class Record {

	private $param;
	private $db;
	private $mode;
	function __construct($mode = "r", $debug = false) {
		global $db_dudu_w, $db_dudu_r;
		$this->mode = $mode;
		if ($this->mode == 'w') {
			$this->param = paramSwap($db_dudu_w);
		} else {
			$this->param = paramSwap($db_dudu_r);
		}
		
		$this->db = new MysqlDB($this->param);
	}
	
	public function getRecordByUser($userid,$page=1,$size=10){
		$p=($page-1)*10;
		$sql="select * from record where userid=$userid order by id asc limit $p,$size";
		$rs=$this->db->queryArray($sql);
		return $rs;
	}
	
	public function CloseDB(){
		$this->db->close();
	}
}
?>